package com.example.mapper;

import com.example.pojo.Teacher;
import com.example.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.beans.factory.annotation.Value;

import java.util.List;

@Mapper
public interface TeacherMapper {
    //添加教师信息
    @Insert("insert into t_manager_teacher(teacher_name,subject,profession,school,introduce,login_id) value" +
            "(#{teacherName},#{subject},#{profession},#{school},#{introduce},#{loginId})")
    void insertTeacher(Teacher teacher);

    //查询教师列表
    @Select("select * from t_manager_teacher")
    List<Teacher> list();

    //根据id查询教师信息
    @Select("select * from t_manager_teacher where id = #{id}")
    Teacher queryById(Integer id);

    //根据姓名查询教师信息
    @Select("select * from t_manager_teacher where teacher_name = #{teacherName}")
    Teacher queryByName(String teachName);

    //编辑教师信息
    void updateTeacher(Teacher teacher);
    //关联用户表
    void connectUser(String teachName);
}
